//PITCH PROGRAM
//CLASS: AI_BID
//	-set conditions for computer to bid, get
//	computer bid, and get computer bid suit
//BY: ALEX TRACY
public class AI_Bid 
{
	private double bids[] = new double[4]; 
	private int maxBidS;
	
	//determine what suit has the best bid
	public int getBidSuit(int[] h)
	{
		getBid(h);
		double maxBid = 0;
		for (int i = 0; i < 4; i++)
		{
			if (bids[i] > maxBid)
			{	
				maxBidS = i;
				maxBid = bids[i];
			}	
		}
		return maxBidS;
		
	}//end getMaxBid
	
	//get the bid for the best suit
	public int getBidValue(int h[])
	{
		int temp = getBidSuit(h);
		
		if (bids[temp] < 2)
			return 0;
		else if (bids[temp] > 4)
			return 4;
		else
			return (int)bids[getBidSuit(h)];
	}
	
	//determine the bids for each suit
	private void getBid(int[] h)
	{
		for (int i=0 ; i < bids.length; i++)
			bids[i] = 0;
		for (int i = 0; i < 6 ; i++ )
		{
			switch (Card.getSuit(h[i]))
			{
				case 0: bids[0] += getCardBidWorth(h[i] ); break;
				case 1: bids[1] += getCardBidWorth(h[i] ); break;
				case 2: bids[2] += getCardBidWorth(h[i] ); break;
				case 3: bids[3] += getCardBidWorth(h[i] ); break;
			}
		}
	}//end getBid
	
	//set bidValue for card
	//2 = .55
	//3 - 8 = .3
	//9 = .35
	//10 = .40
	//j = 1.0
	//q = .75
	//k = .85
	//a = 2.0
	private double getCardBidWorth(int n)
	{
		switch (Card.getFace(n))
		{
			case 0:   
				return 0.55;
			case 1: case 2: case 3: case 4: case 5: case 6: 
				return 0.3;
			case 7:
				return 0.35;
			case 8:
				return 0.4;
			case 9: 
				return 1.0;
			case 10:
				return .75;
			case 11:
				return .85;
			case 12:
				return 2.0;
			default:
				return 0;
				
		}//End Switch
	}//End getBidWorth
}//End AI_Bid Class
